package com.isunland.managesystem.ui;

import com.google.gson.Gson;
import com.isunland.managesystem.base.BaseNetworkDialogFragment;
import com.isunland.managesystem.common.ApiConst;
import com.isunland.managesystem.entity.CMaterialKind;
import com.isunland.managesystem.entity.CMaterialKindListOriginal;
import com.isunland.managesystem.entity.CustomerDialog;
import java.util.ArrayList;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2017/4/6 14:59
 */

public class CMaterialKindDialogFragment extends BaseNetworkDialogFragment {
  @Override public ArrayList<CustomerDialog> resolveResponse(String arg0) {
    ArrayList<CustomerDialog> list = new ArrayList<>();
    CMaterialKindListOriginal original = new Gson().fromJson(arg0, CMaterialKindListOriginal.class);
    ArrayList<CMaterialKind> dataList = original.getRows();
    for (int i = 0; i < dataList.size(); i++) {
      list.add(new CustomerDialog(dataList.get(i).getMaterialKindCom(),
          dataList.get(i).getMaterialKindCode()));
    }

    return list;
  }

  @Override public String getUrl() {
    return ApiConst.URL_QUERY_LIST_CMATERIALKIND;
  }
}
